﻿// <copyright file="IScoped.cs" company="Beuth Hochschule für Technik">
// Breakdown - Configure your Windows 7 Firewall
// Copyright (C) 2009 Stefan "dersteps@gmail.com" Matyba
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; 
// either version 3 of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
// </copyright>
// <author>Stefan Matyba</author>
// <email>dersteps@gmail.com</email>
// <date>2009-10-18</date>
// <summary>Breakdown Application Logic - Interface for scoped rules (affecting only certain IP addresses)</summary>

namespace Breakdown.Logic
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Net;
    using System.Text;
        
    /// <summary>
    /// All classes (Rules!) implementing this interface only affect certain IP Addresses (are scoped)
    /// </summary>
    public interface IScoped
    {
        /// <summary>
        /// Gets the list of affected local IP addresses
        /// </summary>
        Collection<IPAddress> LocalAddresses { get; }

        /// <summary>
        /// Gets the list of affected remote IP addresses
        /// </summary>
        Collection<IPAddress> RemoteAddresses { get; }

        /// <summary>
        /// Gets or sets a value indicating whether or not this rule applies to any local IP address
        /// </summary>
        bool AnyLocalAddress { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether or not this rule applies to any remote IP address
        /// </summary>
        bool AnyRemoteAddress { get; set; }

        /// <summary>
        /// Adds a local IP address
        /// </summary>
        /// <param name="ip">The IP address to be added</param>
        /// <returns>Amount of local IP addresses after addition</returns>
        int AddLocal(IPAddress ip);

        /// <summary>
        /// Removes a local IP address
        /// </summary>
        /// <param name="ip">The IP address to be removed</param>
        /// <returns>Amount of local IP addresses after addition</returns>
        int RemoveLocal(IPAddress ip);

        /// <summary>
        /// Removes all local IP addresses
        /// </summary>
        void ClearLocal();

        /// <summary>
        /// Adds a remote IP address
        /// </summary>
        /// <param name="ip">The IP address to be added</param>
        /// <returns>Amount of remote IP addresses after addition</returns>
        int AddRemote(IPAddress ip);

        /// <summary>
        /// Removes a remote IP address
        /// </summary>
        /// <param name="ip">The IP address to be removed</param>
        /// <returns>Amount of remote IP addresses after addition</returns>
        int RemoveRemote(IPAddress ip);

        /// <summary>
        /// Removes all remote IP addresses
        /// </summary>
        void ClearRemote();
    }
}
